import BaseMonsterSkill from "./BaseMonsterSkill";
import IBaseMonsterSkill from "./IBaseMonsterSkill";
import MonsterScript from "../../../component/MonsterScript";
import GlobalData from "../../../db/GlobalData";
import MonsterSkillVO from "../../../db/vo/MonsterSkillVO";



export default class RandomSkill extends BaseMonsterSkill implements IBaseMonsterSkill {

 

    init(target: MonsterScript, skillId) {


        let skillTable: any = GlobalData.getAllValue(GlobalData.MonsterSkillVO);
        let skillVO: MonsterSkillVO = skillTable[Math.floor(Math.random() * skillTable.length)];
        if (skillVO.className === "RandomSkill") {
            skillId = 10001;
        }
        else {
            skillId = skillVO.id;
        }
        let monsterSkill: IBaseMonsterSkill = Laya.ClassUtils.getInstance("MonsterSkill_" + skillId);
        monsterSkill.init(target, skillId);
        target.skills.push(monsterSkill);
    }

  

    exec() {
        // console.log("ShieldSkill exec")


    }

    // static getRandomSkillId():number{
    //     let skillId=10001;
    //     let skillTable: any = GlobalData.getAllValue(GlobalData.MonsterSkillVO);
    //     let skillVO: MonsterSkillVO = skillTable[Math.floor(Math.random() * skillTable.length)];
    //     if (skillVO.className !== "RandomSkill") {
    //         skillId = skillVO.id;
    //     }
    //     return skillId;
    // }


}